export const numAddAnimation = (
  amount: number,
  startNum: number,
  maxNum: number
) => {
  let numText = startNum;
  let golb; // 为了清除requestAnimationFrame

  function numSlideFun() {
    // 数字动画
    numText += 2; // 速度的计算可以为小数 。数字越大，滚动越快
    if (numText >= maxNum) {
      numText = maxNum;
      cancelAnimationFrame(golb);
    } else {
      golb = requestAnimationFrame(numSlideFun);
    }
    amount = numText;
    console.log(numText);
  }
  numSlideFun(); // 调用数字动画
};
